<script src="/js/DatePicker/WdatePicker.js" type="text/javascript"></script>
<div>
    <BR>
    <BR>
    <form class="form-horizontal" action=""  method="get">
        <div align="right">
            <p>
                <span class="add-on">提交审核时间</span>
                <select name="date_type" id="date_type">
                    <option value="0">自定义</option>
                    <option value="1">近1天提交的广告</option>
                    <option value="3">近3天提交的广告</option>
                    <option value="5">近5天提交的广告</option>
                </select>
                <input class="Wdate " type="text" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="begin_time" placeholder="开始时间" value="<?= $params['begin_time'] ?>">
                ~
                <input class="Wdate "  type="text" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="end_time" placeholder="结束时间" value="<?= $params['end_time'] ?>">
            </p>
            <p>
                <input class="input-medium" type="text" placeholder="输入关键字" name="key_word" value="<?= $params['key_word'] ?>">
                <button type="submit" class="btn btn-primary">搜索</button>
            </p>
        </div>

        <table class =" table table-bordered">
            <tr>
                <td>广告名称</td>
                <td>审核状态</td>
                <td>投放时间</td>
                <td>付费方式</td>
                <td>日预算</td>
                <td>提交时间</td>
                <td>所属广告主公司</td>
                <td>操作</td>
            </tr>
            <? if ($list) : ?>
                <? foreach ($list as $val) : ?>
                    <tr>
                        <td><?= $val['ad_name'] ?></td>
                        <td><?= $val['state'] ?></td>
                        <td><?= date('Y-m-d', $val['begin_time']) ?>~<?= date('Y-m-d', $val['end_tine']) ?></td>
                        <td><?= $val['ad_name'] ?></td>
                        <td><?= $val['ad_name'] ?></td>
                        <td><?= date('Y-m-d H:i:s', $val['create_time']) ?></td>
                        <td><?= $val['ad_name'] ?></td>
                        <td>
                            <a  target="_blank" href="/_ad/examine/view-one?ad_id=<?= $val['ad_id'] ?>">
                                <button class="btn" type="button">查看广告</button>
                            </a>
                            <? if (2 == $val['state']) : ?>
                                <button class="btn" type="button" onclick="examine_window(<?= $val['ad_id'] ?>)">审核</button>
                            <? endif; ?>
                        </td>

                    </tr>
                <? endforeach; ?>
            <? endif; ?>
        </table>
        <? if ($multipage): ?>
            <div class="pull-right"><?= $multipage ?></div>
        <? endif; ?>
        <input type="hidden" name="a" value="1" />
    </form>
</div>
<script>
    $("#date_type").attr("value",'<?= $params['date_type'] ?>');
<? if ($err) : ?>
        alert('<?= $err ?>');
<? endif; ?>

    // 更新我的密码
    function examine_window(ad_id)
    {
        $.weeboxs.open('/_ad/examine/examine-window?ad_id=' + ad_id, {
            title:'审核',
            width: 530,
            showButton: false,
            contentType: 'ajax'
        });
    }
</script>